package cn.wolfcode.luowowo.comment.repository;

import cn.wolfcode.luowowo.comment.domain.ScenicComment;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;

import java.util.List;

/**
 * 景点评论数据接口
 */
public interface ScenicCommentMongoRepository extends MongoRepository<ScenicComment, String> {

    /**
     * 用户
     * @param userId
     * @return
     */
    List<ScenicComment> findByUserId(Long userId);

    /**
     * 获取景点真实评论
     * @param id
     * @return
     */
    int countByScenicId(Long id);

    /**
     * 景点评论的类型
     * @param category
     * @param scenicId
     * @param pageable
     * @return
     */
    Page<ScenicComment> findByCategoryAndScenicId(Integer category, Long scenicId, Pageable pageable);

    /**
     * 获取景点评论  带上分页
     * @param scenicId
     * @param pageable
     * @return
     */
    Page<ScenicComment> findByScenicId(Long scenicId, Pageable pageable);

    /**
     *评论类型 1差 2中 3好
     * @param category
     * @param id
     * @return
     */
    Integer countByCategoryAndScenicId(Integer category, Long id);
}
